package com.androider.timememory.service;

import com.androider.timememory.sms.SMSHandler;
import com.androider.timememory.sms.SMSObserver;
import com.androider.timememory.utils.SMSUtil;

import android.app.Service;
import android.content.ContentResolver;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class SMSService extends Service {
	private SMSObserver mObserver;
	
	@Override
	public void onCreate() {
		super.onCreate();

		ContentResolver resolver = getContentResolver();
		SMSHandler mHandler = new SMSHandler(this);
        mObserver = new SMSObserver(resolver, mHandler);
        resolver.registerContentObserver(SMSUtil.CONTENT_URI, true, mObserver);
        Log.i("SMSService", "onCreate");
	}
	
	@Override
	public void onDestroy() {
		this.getContentResolver().unregisterContentObserver(mObserver);
		
		super.onDestroy();
		System.exit(0);
	}
	
	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
